<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,member-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<script type="text/javascript" src="lib/PIE_IE678.js"></script>
<![endif]-->
<link href="css/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="css/H-ui.admin.css" rel="stylesheet" type="text/css" />
<link href="lib/Hui-iconfont/1.0.1/iconfont.css" rel="stylesheet"
	type="text/css" />
<link href="css/pagination.css" rel="stylesheet" type="text/css" />
<!--[if IE 6]>
<script type="text/javascript" src="http://lib.h-ui.net/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>配送员管理</title>
<style>
.title {
	display: block;
	background: #5a98de;
	line-height: 31px;
	float: left;
	color: white;
	width: 95px;
	text-align: center;
}

.title:hover {
	text-decoration: none;
	color: white;
}
</style>
</head>
<body>
	<nav class="breadcrumb">
		<i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span>
		配送中心 <span class="c-gray en">&gt;</span> 配送管理 <a
			class="btn btn-success btn-refresh radius r mr-20"
			style="line-height: 1.6em; margin-top: 3px"
			onclick="javascript:location.replace(location.href);"
			href="javascript:location.replace(location.href);" title="刷新">刷新</a>
		<a class="btn btn-primary radius r mr-20 mt-5"
			onclick="t_member_add('添加T_member','<%=path%>/backstage/t_member_shipper-add-pre')"
			href="javascript:;"> 添加配送员</a>
	</nav>
	<div class="pd-20">
		<div class="cl pd-5 bg-1 bk-gray">
			<a id="all"
				style="border-top-left-radius: 5px; border-bottom-left-radius: 5px;"
				class="title">全部</a> <a id="one" style="" class="title">配送中</a> <a
				id="two" style="" class="title">空闲</a> <a id="three" style=""
				class="title">离岗</a> <a id="four"
				style="border-top-right-radius: 5px; border-bottom-right-radius: 5px;"
				class="title">休息</a>
		</div>

		<div class="cl pd-5 bg-1 bk-gray" style="margin-top: 20px;">

			<form action="<%=path%>/backstage/shipper_list_byterm" method="post"
				class="form form-horizontal" id="form-list_byterm">
				<div class="text-c">
					<div class="row cl">
						<label class="form-label col-1">配送员：</label>
						<div class="formControls col-2">
							<input type="hidden" value="${working_status }"
								name="working_status" id="working_status"> <input
								type="text" value="${c_tname}" name="c_tname" id="c_tname"
								placeholder="配送员" class="input-text">
						</div>

						<label class="form-label col-1">联系电话：</label>
						<div class="formControls col-2">
							<input type="text" value="${c_mob}" name="c_mob" id="c_mob"
								placeholder="联系电话" class="input-text">
						</div>
						<label class="form-label col-1">配送分站：</label>
						<div class="formControls col-2">
							<span class="select-box"> <select name="c_city"
								class="select">
									<option value="">默认</option>
									<c:forEach items="${citys}" var="city">
										<option value="${city.id}"
											<c:if test="${city.id==c_city}">selected</c:if>>${city.name}</option>
									</c:forEach>
							</select>
							</span>
						</div>
					</div>
					<div class="row cl">
						<label class="form-label col-1">编号：</label>
						<div class="formControls col-2">
							<input type="text" value="${id}" name="id" id="id"
								placeholder="编号" class="input-text">
						</div>
					</div>
					<div class="row cl">
						<button name="" id="" class="btn btn-success"
							style="border-radius: 5px; float: right;" type="submit">
							查询</button>
						<div style="width: 10px; height: 5px; float: right;"></div>
						<a class="btn btn-danger radius"
							onclick="type_reset('<%=path%>/backstage/t_member_shipper_list')"
							href="javascript:;" style="border-radius: 5px; float: right;">
							<i class="Hui-iconfont"></i>重置
						</a>
					</div>
				</div>
			</form>

		</div>

		<div class="mt-20">
			<table
				class="table table-border table-bordered table-hover table-bg table-sort">
				<thead>
					<tr class="text-c">

						<th width="80">编号</th>
						<th width="80">配送员</th>

						<th width="80">分站位置</th>
						<th width="80">联系电话</th>
						<th width="80">当前状态</th>

						<th width="100">操作</th>
					</tr>
				</thead>
				<tbody>
					<c:forEach items="${t_member_shipper}" var="shipper">

						<tr class="text-c">
							<input type="hidden" id="id" name="id" value='${shipper.id}' />
							<td>${shipper.id}</td>
							<td>${shipper.c_tname}</td>
							<td>${shipper.c_cityname}</td>

							<td>${shipper.c_mob}</td>
							<td><c:if test="${shipper.working_status==0}">
							离岗
							</c:if> <%
 	int aa = 0;
 %> <c:if test="${shipper.working_status==1}">
									<c:forEach items="${shippings}" var="shippings">
										<c:if test="${shipper.user_id==shippings.user_id}">
											<%
												aa = 1;
											%>
										</c:if>
									</c:forEach>
									<%
										if (aa == 1) {
									%>
									配送中
								<%
										} else {
									%>
									空闲
								<%
										}
									%>
								</c:if> <c:if test="${shipper.working_status==2}">
							小休
							</c:if></td>
							<td class="td-manage"><a style="text-decoration: none"
								onClick="t_member_show(this,'${shipper.id}')"
								href="javascript:void(0);" title="详情">详情</a>
								&nbsp;&nbsp;&nbsp;&nbsp; <a style="text-decoration: none"
								onClick="t_member_edit(this,'${shipper.id}')"
								href="javascript:void(0);" title="编辑">编辑</a>
								&nbsp;&nbsp;&nbsp;&nbsp; <a style="text-decoration: none"
								onClick="t_member_delete(this,'${shipper.id}')"
								href="javascript:void(0);" title="删除">删除</a></td>
						</tr>
					</c:forEach>
				</tbody>
			</table>
			<div id="Pagination" class="page-con"></div>
		</div>
	</div>
	<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
	<script type="text/javascript" src="lib/layer/1.9.3/layer.js"></script>
	<script type="text/javascript" src="lib/laypage/1.2/laypage.js"></script>
	<script type="text/javascript" src="lib/My97DatePicker/WdatePicker.js"></script>
	<script type="text/javascript"
		src="lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
	<script type="text/javascript" src="js/H-ui.js"></script>
	<script type="text/javascript" src="js/H-ui.admin.js"></script>
	<script type="text/javascript" src="js/jquery.pagination.js"></script>
	<script type="text/javascript">
	$(function() {
		initPager();
	});
	
	var showCount = ${pageInfo.showCount};
	var currentPage = ${pageInfo.currentPage-1};
	var totalResult = ${pageInfo.totalResult};
	function initPager(){
		$("#Pagination").pagination(totalResult, {
            callback: function(new_page_index, pagination_container){
            	var oldLocation = location.href;
            	var pa = "currentPage=" + (new_page_index+1);
        		var shoC = "showCount=" + showCount;
            	var index = oldLocation.lastIndexOf("?");
            	if (index == -1){
            		location.href = oldLocation + "?" + pa + "&" + shoC;
            	}else if (oldLocation.indexOf("currentPage") == -1){
            		location.href = oldLocation + "&" + pa;
            	}else if (oldLocation.indexOf("showCount") == -1){
            		location.href = oldLocation + "&" + shoC;
            	}else{
            		var temp = oldLocation.replace(/currentPage=\d+/, pa);
					var newLocation = temp.replace(/showCount=\d+/, shoC);
            		location.href = newLocation;
            	}
            	return false;
            },
            items_per_page:showCount, 
            load_first_page:false,
            prev_text:'上一页',
            next_text:'下一页',
            ellipse_text:'...',
            num_edge_entries:1,
            num_display_entries:5,
            current_page:currentPage,
        });
	}

		
		/*重置*/
		function type_reset(url){
			window.location = url;
		}
		
		/*添加*/
		function t_member_add(title, url, w, h) {
			layer_show(title, url, w, h);
		}

		/*详情*/
		function t_member_show(obj,id,w,h){
			var edit_page = "<%=path%>/backstage/t_member_shipper-xq?id="+id;
			var index = layer.open({
				type: 2,
				title: "详情",
				content: edit_page
			});
			layer.full(index);
		}
		
		/*编辑*/
		function t_member_edit(obj,id,w,h){
			var edit_page = "<%=path%>/backstage/t_member_shipper-add-pre?id="+id;
			var index = layer.open({
				type: 2,
				title: "编辑",
				content: edit_page
			});
			layer.full(index);
		}
		
		/*删除*/
		function t_member_delete(obj,id){
			layer.confirm('确认删除？', {
				btn: ['确认','取消'], 
				shade: false
			},
			function(){
				$.ajax({
					type : "POST",
					url : "<%=path%>/backstage/t_member_shipper_del",
					data : "id=" + id,
					error : function() {
						layer.msg('操作失败', {
							icon : 5,
							time : 1000
						});
					},
					success : function(msg) {
						layer.msg('已删除 ' + msg.information, {
							icon : 6,
							time : 1000
						});
						$(obj).parents("body").find(".btn-refresh").click();
					}
				});
			}, function() {
				layer.msg('未删除', {
					icon : 5,
					time : 1000
				});
			});
		}

		if ($("#working_status").val() == 3) {
			$("#all").css({
				"background" : "white",
				"border" : "1px solid black",
				"color" : "black"
			});
			$("#one").css({
				"background" : "#5a98de",
				"border" : "1px solid #5a98de"
			});
			$("#two").css({
				"background" : "white",
				"border" : "1px solid black",
				"color" : "black"
			});
			$("#three").css({
				"background" : "white",
				"border" : "1px solid black",
				"color" : "black"
			});
			$("#four").css({
				"background" : "white",
				"border" : "1px solid black",
				"color" : "black"
			});
		} else if ($("#working_status").val() == 1) {
			$("#all").css({
				"background" : "white",
				"border" : "1px solid black",
				"color" : "black"
			});
			$("#one").css({
				"background" : "white",
				"border" : "1px solid black",
				"color" : "black"
			});
			$("#two").css({
				"background" : "#5a98de",
				"border" : "1px solid #5a98de"
			});
			$("#three").css({
				"background" : "white",
				"border" : "1px solid black",
				"color" : "black"
			});
			$("#four").css({
				"background" : "white",
				"border" : "1px solid black",
				"color" : "black"
			});
		} else if ($("#working_status").val() == 0) {
			$("#all").css({
				"background" : "white",
				"border" : "1px solid black",
				"color" : "black"
			});
			$("#one").css({
				"background" : "white",
				"border" : "1px solid black",
				"color" : "black"
			});
			$("#two").css({
				"background" : "white",
				"border" : "1px solid black",
				"color" : "black"
			});
			$("#three").css({
				"background" : "#5a98de",
				"border" : "1px solid #5a98de"
			});
			$("#four").css({
				"background" : "white",
				"border" : "1px solid black",
				"color" : "black"
			});
		} else if ($("#working_status").val() == 2) {
			$("#all").css({
				"background" : "white",
				"border" : "1px solid black",
				"color" : "black"
			});
			$("#one").css({
				"background" : "white",
				"border" : "1px solid black",
				"color" : "black"
			});
			$("#two").css({
				"background" : "white",
				"border" : "1px solid black",
				"color" : "black"
			});
			$("#three").css({
				"background" : "white",
				"border" : "1px solid black",
				"color" : "black"
			});
			$("#four").css({
				"background" : "#5a98de",
				"border" : "1px solid #5a98de"
			});
		} else {
			$("#all").css({
				"background" : "#5a98de",
				"border" : "1px solid #5a98de"
			});
			$("#one").css({
				"background" : "white",
				"border" : "1px solid black",
				"color" : "black"
			});
			$("#two").css({
				"background" : "white",
				"border" : "1px solid black",
				"color" : "black"
			});
			$("#three").css({
				"background" : "white",
				"border" : "1px solid black",
				"color" : "black"
			});
			$("#four").css({
				"background" : "white",
				"border" : "1px solid black",
				"color" : "black"
			});
		}

		//选择状态
		$("#all").click(function() {
			$("#working_status").val(-1);
			$("#form-list_byterm").submit();
			$("#all").css({
				"background" : "#5a98de",
				"border" : "1px solid #5a98de"
			});
			$("#one").css({
				"background" : "white",
				"border" : "1px solid black",
				"color" : "black"
			});
			$("#two").css({
				"background" : "white",
				"border" : "1px solid black",
				"color" : "black"
			});
			$("#three").css({
				"background" : "white",
				"border" : "1px solid black",
				"color" : "black"
			});
			$("#four").css({
				"background" : "white",
				"border" : "1px solid black",
				"color" : "black"
			});
		});

		//选择状态
		$("#one").click(function() {
			$("#working_status").val(3);
			$("#form-list_byterm").submit();
			$("#all").css({
				"background" : "white",
				"border" : "1px solid black",
				"color" : "black"
			});
			$("#one").css({
				"background" : "#5a98de",
				"border" : "1px solid #5a98de"
			});
			$("#two").css({
				"background" : "white",
				"border" : "1px solid black",
				"color" : "black"
			});
			$("#three").css({
				"background" : "white",
				"border" : "1px solid black",
				"color" : "black"
			});
			$("#four").css({
				"background" : "white",
				"border" : "1px solid black",
				"color" : "black"
			});
		});
		//选择状态
		$("#two").click(function() {
			$("#working_status").val(1);
			$("#form-list_byterm").submit();
			$("#all").css({
				"background" : "white",
				"border" : "1px solid black",
				"color" : "black"
			});
			$("#one").css({
				"background" : "white",
				"border" : "1px solid black",
				"color" : "black"
			});
			$("#two").css({
				"background" : "#5a98de",
				"border" : "1px solid #5a98de"
			});
			$("#three").css({
				"background" : "white",
				"border" : "1px solid black",
				"color" : "black"
			});
			$("#four").css({
				"background" : "white",
				"border" : "1px solid black",
				"color" : "black"
			});
		});
		//选择状态
		$("#three").click(function() {
			$("#working_status").val(0);
			$("#form-list_byterm").submit();
			$("#all").css({
				"background" : "white",
				"border" : "1px solid black",
				"color" : "black"
			});
			$("#one").css({
				"background" : "white",
				"border" : "1px solid black",
				"color" : "black"
			});
			$("#two").css({
				"background" : "white",
				"border" : "1px solid black",
				"color" : "black"
			});
			$("#three").css({
				"background" : "#5a98de",
				"border" : "1px solid #5a98de"
			});
			$("#four").css({
				"background" : "white",
				"border" : "1px solid black",
				"color" : "black"
			});
		});
		//选择状态
		$("#four").click(function() {
			$("#working_status").val(2);
			$("#form-list_byterm").submit();
			$("#all").css({
				"background" : "white",
				"border" : "1px solid black",
				"color" : "black"
			});
			$("#one").css({
				"background" : "white",
				"border" : "1px solid black",
				"color" : "black"
			});
			$("#two").css({
				"background" : "white",
				"border" : "1px solid black",
				"color" : "black"
			});
			$("#three").css({
				"background" : "white",
				"border" : "1px solid black",
				"color" : "black"
			});
			$("#four").css({
				"background" : "#5a98de",
				"border" : "1px solid #5a98de"
			});
		});
	</script>
</body>
</html>



